1. Technology Field
The present invention relates to a memory management and writing method and particularly to a memory management and writing method for managing rewritable non-volatile memory, and a memory controller and a memory storage system using the same.
2. Description of Related Art
Digital cameras, cells phones, and digital music players have undergone rapid growth in recent years, so that consumer demand for storage media have also rapid increased. Rewritable non-volatile memory is one of the most adaptable memories for such battery-powered portable products due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure. A solid state drive (SSD) is a storage apparatus adopting rewritable non-volatile memory as storage medium. Rewritable non-volatile memory has been broadly used for storing important personal data thanks to its small volume and large capacity. Therefore, the rewritable non-volatile memory industry has become a very important part of the electronic industry in recent years.
Taking a storage device adopting a flash memory module as storage medium as an example, the memory unit of the flash memory module has a plurality of physical blocks, and each physical block has a plurality of physical pages, wherein data must be written into a physical block according to the sequence of the physical pages in the physical block. Additionally, a physical page stored data thereon has to be erased before being written in again. In particular, a smallest unit for erasing data is one physical block, and a smallest unit for programming (also referred to writing) data is one physical page. Therefore, in the management of the flash memory module, the physical blocks are grouped into a data area and a spare area. The physical blocks of the data area are used for storing data written by the host system. And, the physical blocks of the spare area are used for substituting the physical blocks of the data area. Hence, the physical blocks in the spare area are either blank or available blocks (i.e., no data is recorded in these blocks or data recorded in these blocks is marked as invalid data). In other words, the physical blocks in the data area and the spare area are alternatively used to store data written into the storage apparatus by the host system. For example, when the host system is about to store data in the storage apparatus, the memory management circuit of the storage apparatus identifies a physical block to be updated and gets a physical block from the spare area to substitute the physical block to be updated for writing data. To be specific, the memory management circuit of the storage apparatus copies valid data from the physical block to be updated to the gotten physical block, writes data to be written into the gotten physical block and associates the gotten physical block with the data area. Additionally, an erasing operation is performed to the physical block to be updated and the erased physical block is associated with the spare area.
In particular, in a case where the flash memory module has a plurality of memory units and the memory units transmit data with individual data input/output buses, the physical blocks of the memory units are grouped into a plurality of physical units and managed in unit of each physical unit. To be specific, each of the physical unit is composed of one corresponding physical block of each memory unit. For example, in a case where the flash memory module has a first memory unit and a second memory unit, one corresponding physical block in the first memory unit and one corresponding physical block in the second memory unit are grouped fixedly into one physical unit. And, in the operation of grouping the physical blocks into the data area and spare area and the writing operation, the memory management circuit operates the physical blocks in unit of each physical unit, thereby reducing resources needed for managing the memory module. Additionally, the speed for writing data can effectively be increased by simultaneously writing data into several physical blocks in one physical unit through several data input/output buses.
With the progress of semiconductor technology, the capacity of each physical page in the physical blocks becomes larger. However, in a case where a SSD is served as a main hard disk of a host system, because the length of sequential data written by the host system is smaller than the capacity of one physical page, the memory management circuit needs to spend more time to execute the above-mentioned operation of copying valid data, thereby influencing the performance of the storage apparatus.
Additionally, the number of times of writing data into one physical block (referred to the writing count of the physical block thereafter) is limited. However, in the above-mentioned management framework operating in unit of each physical unit, when the host system only writes data into one of physical blocks in a physical unit, the memory management circuit still needs to execute the erasing operation in unit of the physical unit. Accordingly, the writing count of physical blocks will be increased fast due to the operation of copying valid data, thereby shortening the lifespan of the storage apparatus.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.